class Bug(object):
    legs = 0
    distance = 0

    def __init__(self, name='Bug', legs=6):
        self.name = name
        self.legs = legs

    def walk(self, distance=1):
        self.distance += distance

    def getDistance(self):
        return self.distance

    def setDistance(self, value):
        self.distance = value

    def toString(self):
        return self.name+' has '+str(self.legs) + ' legs' +  \
            ' and taken ' + str(self.distance) + ' steps.'


# default constructor
ant = Bug()
for n in range(0, 5):
    ant.walk()
print(ant.toString())

# one constructor parameter
beetle = Bug('Beetle')
for n in range(0, 10):
    beetle.walk()
print(beetle.toString())

# two constructor parameters
spider = Bug('Spider', 8)
for n in range(0, 10):
    spider.walk(2)
print(spider.toString())
